package com.weixin.gong.example.jdk.bean;

import org.junit.Test;


/**
 * Created at 2017/8/30 15:53
 *
 * @author gongweixin
 */
public class DoWhileExample {

    @Test
    public void testThread() {
        Integer next = null;
        do {
            System.out.println(next);
            next = next(next);
        } while (next != null);
    }

    private Integer next(Integer i) {
        if (i == null) return 0;
        return i > 5 ? null : ++i;
    }
}
